<template>
  <div class>
    <Navbar title="新闻列表"></Navbar>
    <!-- 新闻列表 -->
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="(item,index) in newsList" :key="item.id">
        <!-- <router-link :to="'/home/newsinfo/'+item.id"> -->
        <router-link to="/home/newsinfo/">
          <img class="mui-media-object mui-pull-left" :src="item.img_url" />
          <h5 class="mui-media-body">
            {{item.title}}
            <p class="mui-ellipsis">能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</p>
            <span>点赞数：{{item.click}}</span>
            <span>发表时间：{{item.add_item|conevrTiem('YYYY-MM-DD')}}</span>
          </h5>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
import Navbar from "../../common/navbar";
export default {
  data() {
    return {
      newsList: []
    };
  },
  created() {
    this.$axios.get("/newsList").then(data => {
      this.newsList = data.data;
      console.log(data);
    });
  },
  components: {
    Navbar
  }
};
</script>

<style lang="less" scoped>
.mui-table-view {
  .mui-table-view-cell {
    .mui-media-body {
      color: #0000;
      span {
        font-size: 13px;
        margin-top: 5px;
        color: orange;
      }
    }
  }
}
</style>